package cn.tedu.ivos.config;

import cn.tedu.ivos.filter.JwtAuthenticationFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class WebConfig {
    @Bean
    public FilterRegistrationBean filterRegistrationBean(){
        //注册filter
        FilterRegistrationBean filterRegistrationBean =
                new FilterRegistrationBean(new JwtAuthenticationFilter());
        //过滤所有请求
        filterRegistrationBean.addUrlPatterns("/api/*");
        return filterRegistrationBean;
    }
}
